﻿/* 2012/2/21 */
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Cosmos.Windows.Themes;

namespace PictureShower
{
    public partial class GroupOptionComboBox : ComboBox
    {
        public GroupOptionComboBox()
        {
            InitializeComponent();

            foreach (GroupOption aGroupOption in GroupOptionHelper.GroupOptions)
                Items.Add(new GroupOptionComboBoxItem(aGroupOption));
            SelectedIndex = 0;
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
        }

        public new GroupOptionComboBoxItem SelectedItem
        {
            get { return (GroupOptionComboBoxItem)base.SelectedItem; }
            set { base.SelectedItem = value; }
        }

        public GroupOption GroupOption
        {
            get { return ((GroupOptionComboBoxItem)base.SelectedItem).GroupOption; }
            set
            {
                foreach (object anItem in Items)
                {
                    GroupOptionComboBoxItem theItem = (GroupOptionComboBoxItem)anItem;
                    if (theItem.GroupOption == value)
                    {
                        base.SelectedItem = anItem;
                        break;
                    }
                }
            }
        }
    }
}
